﻿<section ng-controller="OnlineSupportController">
	<h1 class="page-header">Quản lý tư vấn trực tuyến</h1>
	
	<div>
		<form ng-submit="addForm.$valid && addOnlineSupport()" name="addForm" >
		<div class="col-xs-12 col-md-12 mg-b2">
			<div class="col-md-1 f-bold">Tên</div>
			<div class="col-md-2">
				<input type="text"  class="form-control " placeholder="Nhập tên..." ng-model="supName" name="supName" required>
			</div>
			<div class="col-md-1 f-bold">Số điện thoại</div>
			<div class="col-md-2">
				<input type="text"  class="form-control " placeholder="Nhập sđt..." ng-model="supPhone" name="supPhone" required>
			</div>		
			<div class="col-md-1 f-bold">Mail</div>
			<div class="col-md-2">
				<input type="text"  class="form-control " placeholder="Nhập mail..." ng-model="supMail" name="supMail" required>
			</div>
			<div class="col-md-2">
				<button type="submit" class="btn btn-primary" ng-disabled="addForm.$invalid"><span class="glyphicon glyphicon-plus"></span> Thêm</button>
			</div>
		</div>
			<div class="alert fadeInDown animated" ng-class="{'alert-danger': !status, 'alert-success': status}" role="alert" ng-show="msg!=''">
				<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true" ng-show="!status"></span>
				<span class="glyphicon glyphicon-ok" aria-hidden="true" ng-show="status"></span>
				{{msg}}
			</div>
		</form>
	</div>
	<div class="col-xs-12 col-md-12">
		<table class="table" ng-init="getOnlineSupportList()">
			<tr class="f-bold">
				<td>Tên</td>
				<td>Số điện thoại</td>
				<td>Mail</td>
				<td>Xóa</td>
			</tr>
			<tr ng-repeat="item in onlineSupportList">
				<td><a href="#" editable-text="item.name" onbeforesave="updateOnlineSupport($data,item.id,'name')">{{ item.name}}</a></td>
				<td><a href="#" editable-text="item.mobile" onbeforesave="updateOnlineSupport($data,item.id,'mobile')">{{ item.mobile}}</a></td>
				<td><a href="#" editable-text="item.email" onbeforesave="updateOnlineSupport($data,item.id,'email')">{{ item.email}}</a></td>
				<td><a href="javascript:void(0)" ng-click="deleteOnlineSupport(item.id)"><span class="glyphicon glyphicon-trash"></span></a></td>
			</tr>
			
		</table>
	</div>
</section>